#ifndef SDK_OHOS_OHOS_VIDEO_SOURCE_H_
#define SDK_OHOS_OHOS_VIDEO_SOURCE_H_

#include "api/ohos_video_source_interface.h"
#include "api/media_stream_interface.h"
#include "rtc_base/logging.h"
#include "media/base/adapted_video_track_source.h"
#include "api/ohos_peer_connection_factory_interface.h"

namespace ohoswebrtc {

class OHOSVideoSource : public OHOSVideoSourceInterface {
  public:
    OHOSVideoSource(rtc::scoped_refptr<OHOSPeerConnectionFactoryInterface> peer_connection_factory, rtc::Thread* signaling_thread, rtc::Thread* worker_thread, const bool is_screen_cast);
    OHOSVideoSource(rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> video_source, rtc::scoped_refptr<OHOSPeerConnectionFactoryInterface> peer_connection_factory);
    virtual ~OHOSVideoSource();
    /** native  VideoTrackSource*/
    rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> video_source() override {
      return video_source_;
    }
    
    /** The state of the video source. */
    OHOSMediaSourceState state() const override {
      return static_cast<OHOSMediaSourceState>(video_source_->state());
    }

    /**Capture call OnCapturedFrame to support frame */
    void OnCapturedFrame(const webrtc::VideoFrame &frame) override;
  
    bool is_screencast() override;

  private:
    rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> video_source_;
    rtc::scoped_refptr<OHOSPeerConnectionFactoryInterface> peer_connection_factory_;
};

}

#endif